<template>
	<view class="page">
		<u-card padding="0" :border="false" margin="0" border-radius="0" :foot-border-top="false"
			:head-border-bottom="false">
			<view class="card-head" slot="head">运单信息</view>
			<view class="card-body" slot="body">
				<view class="u-body-item">
					<view class="item">
						<view class="title">货运订单:</view>
						<view class="info">{{demandOrder.orderNo||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">货运订单类型:</view>
						<view class="info">{{demandOrder.orderType||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">交货单:</view>
						<view class="info">{{demandOrder.deliverNo||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">源位置:</view>
						<view class="info">{{demandOrder.startLocationNo||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">源位置名称:</view>
						<view class="info">{{demandOrder.startLocationName||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">源位置区域（省份）:</view>
						<view class="info">{{demandOrder.startLocationArea||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">源位置城市:</view>
						<view class="info">{{demandOrder.startLocationCity||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">源位置街道:</view>
						<view class="info">{{demandOrder.startLocationStreet||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">目标位置:</view>
						<view class="info">{{demandOrder.targetLocationNo||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">目标位置名称:</view>
						<view class="info">{{demandOrder.targetLocationName||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">承运商名称:</view>
						<view class="info">{{demandOrder.carrierName||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">计划提货日期:</view>
						<view class="info">{{demandOrder.planGetGoodsDateStart||''}}</view>
					</view>
				</view>
				<view class="u-body-item">
					<view class="item">
						<view class="title">计划收货日期:</view>
						<view class="info">{{demandOrder.planGetGoodsDateEnd||''}}</view>
					</view>
				</view>
			</view>
		</u-card>
		<u-card padding="0" :border="false" margin="0" border-radius="0" :foot-border-top="false"
			:head-border-bottom="false">
			<view class="card-head" slot="head">物料信息</view>
			<view class="card-body" slot="body">
				<!-- <u-table>
					<u-tr>
						<u-th width="16.66%">行项目号</u-th>
						<u-th width="16.66%">物料</u-th>
						<u-th width="16.66%">物料描述</u-th>
						<u-th width="16.66%">原交货数量</u-th>
						<u-th width="16.66%">剩余数量</u-th>
						<u-th width="16.66%">交货数量单位</u-th>
					</u-tr>
					<u-tr v-for="(item,index) in demandOrderItemList" :key="index">
						<u-td width="16.66%">{{item.itemNo||''}}</u-td>
						<u-td width="16.66%">{{item.matCode||''}}</u-td>
						<u-td width="16.66%">{{item.matDesc||''}}</u-td>
						<u-td width="16.66%">{{item.originNum||''}}</u-td>
						<u-td width="16.66%">{{item.num||''}}</u-td>
						<u-td width="16.66%">{{item.unit||''}}</u-td>
					</u-tr>
				</u-table> -->
				<view class="table">
					<view class="tr">
						<view class="th">行项目号</view>
						<view class="th">物料</view>
						<view class="th">物料描述</view>
						<view class="th">原交货数量</view>
						<view class="th">剩余数量</view>
						<view class="th">交货数量单位</view>
					</view>
					<view class="tr" v-for="(item,index) in demandOrderItemList" :key="index">
						<view class="td">{{item.itemNo||''}}</view>
						<view class="td">{{item.matCode||''}}</view>
						<view class="td">{{item.matDesc||''}}</view>
						<view class="td">{{item.originNum||''}}</view>
						<view class="td">{{item.num||''}}</view>
						<view class="td">{{item.unit||''}}</view>

					</view>
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				demandOrder: {}, //订单信息
				demandOrderItemList: [], //物料信息
			}
		},
		onLoad(option) {
			if (option.id) {
				uni.showLoading({
					title: '加载中'
				})
				this.$u.api.carrier.getDemandDetail({
					id: option.id,
				}).then(data => {
					uni.hideLoading()
					if (data.code === 200 && data.success) {
						this.demandOrder = data.data.demandOrder
						this.demandOrderItemList = data.data.demandOrderItemList
					}
				}).catch(() => {
					uni.hideLoading()
				})
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	.page {
		min-height: 100vh;
		width: 750rpx;
		background-color: #f9f9f9;
		padding-top: 20rpx;
		padding-bottom: 40rpx;
		box-sizing: border-box;

		.card-head {
			color: $uni-color-primary;
			font-size: 38rpx;
			font-weight: 600;
			padding: 30rpx 0;
			width: 690rpx;
			margin: 0 auto;
			border-bottom: 4rpx solid $uni-color-primary;
		}

		.card-body {
			width: 750rpx;
			padding: 30rpx;
			box-sizing: border-box;

			.table {
				width: 100%;
				border: 2rpx solid #e4e7ed;
				display: table;

				.tr {
					width: 100%;
					display: table-row;

					:last-child {
						border-right-width: 0 !important;
					}

					.th {
						width: 16.66%;
						display: table-cell;
						vertical-align: middle;
						text-align: center;
						font-size: 28rpx;
						color: #303133;
						font-weight: bold;
						background-color: #f5f6f8;
						text-align: center;
						padding: 10rpx 6rpx;
						border-bottom: solid 2rpx #e4e7ed;
						border-right: solid 2rpx #e4e7ed;
						word-break: break-all;
					}

					.td {
						width: 16.66%;
						display: table-cell;
						vertical-align: middle;
						text-align: center;
						font-size: 26rpx;
						color: #606266;
						text-align: center;
						padding: 10rpx 6rpx;
						border-right: solid 2rpx #e4e7ed;
						word-break: break-all;
					}
				}
			}
		}

		.u-body-item {
			font-size: 28rpx;
			color: #999999;
			width: 100%;
			margin-bottom: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 750rpx;
			box-sizing: border-box;

			.item {
				display: flex;
				justify-content: flex-start;
				align-items: flex-start;

				.title {
					width: 260rpx;
				}

				.info {
					width: 430rpx;
					color: #333333;
					word-break: break-all;
				}
			}

		}
	}
</style>
